const inputEl = document.querySelector("input");
const cancelEl = document.querySelector("#cancel");
let counter = 0;
const inputChange = debounce(
  function () {
    console.log(`发送了${++counter}次网络请求`, this);
  },
  2000,
  true
);
inputEl.oninput = inputChange;

cancelEl.addEventListener("click", function () {
  inputChange.cancel();
});
